import { _decorator, Component, Node, Size } from 'cc';
import { cc_gui } from '../../cc-gui/script/GUI/GUI';
const { ccclass, property } = _decorator;

@ccclass('GUITest')
export class GUITest extends Component {
    protected onLoad(): void {}

    protected start(): void {
        this.guiTest();
    }

    async guiTest() {
        const root = await cc_gui.createWindows(
            'Title',
            new Size(300, 600),
        );
        this.node.addChild(root.node);
        cc_gui.addGroup('hello');
        cc_gui.addGroup('world').then((group) => {
            cc_gui.addGroup('123456', group);
            cc_gui.addButton(
                'groupButton',
                () => {
                    console.log('groupButton');
                },
                group,
            );
            cc_gui.addGroup('abcde', group);
        });

        cc_gui.addButton('click', () => {
            console.log('click button');
        });
    }
}
